<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var ary = [1, 2, 3, 4]

        function fn(ary) {
            ary[0] = 0 // [0,2,3,4]
            ary = [0] // [0] //开辟新的空间
            ary[0] = 100 //[100]
            return ary
        }
        var res = fn(ary) 
        console.log(ary) //[0, 2, 3, 4]
        console.log(res) //[100]
    </script>
</body>

</html>